/*
 * $Id: SiteNavigationMenu.java 105 2009-06-30 05:33:29Z donbeave $
 */

package labour.manager.client.widget.menu;

import labour.concept.engine.client.data.Site;

import com.extjs.gxt.ui.client.widget.menu.Menu;
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
import com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem;

public class SiteNavigationMenu extends Menu {

  private MenuItem viewItem;
  private MenuItem refreshItem;
  private MenuItem publishItem;
  private MenuItem propertiesItem;

  private Site site;

  public SiteNavigationMenu() {
    viewItem = new MenuItem("View");
    refreshItem = new MenuItem("Refresh");
    publishItem = new MenuItem("Disable");
    propertiesItem = new MenuItem("Properties");

    add(viewItem);
    add(refreshItem);
    add(new SeparatorMenuItem());
    add(publishItem);
    add(new SeparatorMenuItem());
    add(propertiesItem);
  }

  public Site getItem() {
    return site;
  }

  public void setItem(Site model) {
    site = model;

    if (site.getModel().isPublished()) {
      getPublishItem().setText("Disable");
    } else {
      getPublishItem().setText("<b>Enable</b>");
    }
  }

  public MenuItem getViewItem() {
    return viewItem;
  }

  public MenuItem getRefreshItem() {
    return refreshItem;
  }

  public MenuItem getPublishItem() {
    return publishItem;
  }

  public MenuItem getPropertiesItem() {
    return propertiesItem;
  }


}
